UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gMgvYe0ggS3oFvjx0fyh06hf5monKyK/v+7FlTjnaoA=' 
WHERE 
  key_id = '22a1a4640b5afeed1b58e5d988bed156335dbd1c95a17ec1fb2db96a286b2977' 
  AND (
    token = 'gMgvYe0ggS3oFvjx0fyh06hf5monKyK/v+7FlTjnaoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022