UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e2FGD8bttx+vh8JvrcJw7DOK8k/ySomHhFTvlR8kyAc=' 
WHERE 
  key_id = '4574eb41c6a9d8188f82598a200af8ad6e863302dbc584194f464d5b32b6120d' 
  AND (
    token = 'e2FGD8bttx+vh8JvrcJw7DOK8k/ySomHhFTvlR8kyAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023