UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vFrGWvStB5ObRMN3qcsZ6HnCWAhOgPgBVW7uLZDPAa8=' 
WHERE 
  key_id = '2ddc8dde84419d5819da99f790f1aa40c897ac2db6ab8b244a63c78fd0cf8988' 
  AND (
    token = 'vFrGWvStB5ObRMN3qcsZ6HnCWAhOgPgBVW7uLZDPAa8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040