UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5wDoOa3n6otnuPfZ+fycWsIQ1wEWSqQP0ran97Q2F2E=' 
WHERE 
  key_id = '6f51ed07e949eb49c910d15cabe57c523879cc2c3b9af617e5a85d1f74e9a9d9' 
  AND (
    token = '5wDoOa3n6otnuPfZ+fycWsIQ1wEWSqQP0ran97Q2F2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060