UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7LTDWJlE14dce0+VH3zuUILIR3ekliIf1uPCN4Inbmw=' 
WHERE 
  key_id = 'ed3a69979b7516be58a11e65bad3331461e696bd63b10b5d9f9581f07e0dd990' 
  AND (
    token = '7LTDWJlE14dce0+VH3zuUILIR3ekliIf1uPCN4Inbmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049