UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k2+IzjAowuUuyu10GfjMTGdpHxSjTYMOCwZ2pESkUH0=' 
WHERE 
  key_id = 'ed4d959727b411ab0b186186a7458a254ffd936e80cca4511d60b012b1aa64e1' 
  AND (
    token = 'k2+IzjAowuUuyu10GfjMTGdpHxSjTYMOCwZ2pESkUH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036