UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KDyhNg5e9nEnm/qVHy+w49s9s8Na0EUW2W5p65XiU/Q=' 
WHERE 
  key_id = 'deb91a10ddafa05993a0a14dd936259ede2429da6e21d8cb93d134e282cf4285' 
  AND (
    token = 'KDyhNg5e9nEnm/qVHy+w49s9s8Na0EUW2W5p65XiU/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034