UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gkr7w0baXdXEvso/nbJK+hFTmtUhkyYKrNhpphxBt1c=' 
WHERE 
  key_id = 'fe4379719182fe86c06a32e3acd9667a1bafaa78bbc7cf224516eea1a7f20b19' 
  AND (
    token = 'gkr7w0baXdXEvso/nbJK+hFTmtUhkyYKrNhpphxBt1c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028