UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DVVSn5TQ0OtmIwoBoG5HUd6+o23NR1U8dkHaw1pB6t8=' 
WHERE 
  key_id = '388e9171ed094fef1d7671b446f3331fec190c304559c958963805839385a008' 
  AND (
    token = 'DVVSn5TQ0OtmIwoBoG5HUd6+o23NR1U8dkHaw1pB6t8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039