UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CiG2k+GPmWU+lyi1rPhoN20+DWxND2k19PkEssUllII=' 
WHERE 
  key_id = 'e90468bdcd65655fbb5682be161545a8c343f1c8eaa71f33b074fac37676fc37' 
  AND (
    token = 'CiG2k+GPmWU+lyi1rPhoN20+DWxND2k19PkEssUllII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033