UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'asTpRRExDEFBDrygg0THTaGXvN3U8ZXgQPze6m5zOnI=' 
WHERE 
  key_id = '6cda845aa162a2b3c3dd6e6d6f97010d0b38a9d612e86e162124fd9f98eebb32' 
  AND (
    token = 'asTpRRExDEFBDrygg0THTaGXvN3U8ZXgQPze6m5zOnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039