UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yg8mLuvuh1CTG5T4h4QUZw2x8lBBp+97dugpjkuOF+Y=' 
WHERE 
  key_id = '60b9b3474662d5f7e17665ba674e8cd8cf98357da0d1554c555ca3eefd243b44' 
  AND (
    token = 'yg8mLuvuh1CTG5T4h4QUZw2x8lBBp+97dugpjkuOF+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026