UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RgunVFm3paKk/cu81RDA+lXB+bZpaDacRJaqQbsPQ+8=' 
WHERE 
  key_id = '152d8f28d8ce89ef7670cbb7784a7ba206b4d87d5a85f05484cc67a6edd36516' 
  AND (
    token = 'RgunVFm3paKk/cu81RDA+lXB+bZpaDacRJaqQbsPQ+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020