UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R1pMsK/R79D0gSfUyeOHeuLdwP1fsvJlxsLQom389ac=' 
WHERE 
  key_id = '47221156cc750a4d2ffe41222c1d96b2fd54e63596ccdc0e51946c5fe5a772d0' 
  AND (
    token = 'R1pMsK/R79D0gSfUyeOHeuLdwP1fsvJlxsLQom389ac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034