UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n5cvcEbuxSdi2crWETNi47Fk3x+Q1KGeUeXXEoVI/Co=' 
WHERE 
  key_id = 'd167532ed3a5c157d7b165c30e5b1eb1ea561aa29da8d094525773c8b2c8c343' 
  AND (
    token = 'n5cvcEbuxSdi2crWETNi47Fk3x+Q1KGeUeXXEoVI/Co=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048