UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OQrb2cVdbogcLG5lP7U/QKJdZy1gKmlgDFVqAvZlUMc=' 
WHERE 
  key_id = '1845bc734fa7e3bff595131bff340986f04ccf814ed8e9b3f6dfc0a219b44b54' 
  AND (
    token = 'OQrb2cVdbogcLG5lP7U/QKJdZy1gKmlgDFVqAvZlUMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00108