UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rSUrJ5x8uY07DTtZTrIeioAThDMVh90njkGhY26JN50=' 
WHERE 
  key_id = 'b47033e43a9c245982179ce26f51c4b6cb2ba14f44d8aa9abc153f39169181e1' 
  AND (
    token = 'rSUrJ5x8uY07DTtZTrIeioAThDMVh90njkGhY26JN50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029