UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oIWa6F7fceh1KTqH84YJHwNLiKv8YWujpOO8m9lminc=' 
WHERE 
  key_id = '62ef536e24daba7ebc57943841d636faa91acaaaa23567921b7427390295ed32' 
  AND (
    token = 'oIWa6F7fceh1KTqH84YJHwNLiKv8YWujpOO8m9lminc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051