UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LIR5MG1cHN0Ng5EbqBG5HnR+h6kLmyz1LJ1PQuy0j1A=' 
WHERE 
  key_id = '4bb340a6d089a8d438adaf9b6111d2164fe013088cc59a34998f81ce18041d90' 
  AND (
    token = 'LIR5MG1cHN0Ng5EbqBG5HnR+h6kLmyz1LJ1PQuy0j1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026