UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5gz2jG0HqLJEx+7n3d/zZn4sdMQExTeaW8jEaqrItSs=' 
WHERE 
  key_id = 'd7193c32ff2d9ae06d28bf8f7594e9a8ec34b21f6b83f1cfda36affc1976a13d' 
  AND (
    token = '5gz2jG0HqLJEx+7n3d/zZn4sdMQExTeaW8jEaqrItSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025