UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r6nsPJq4o1XPMxQ74IqMHxwXOz0zn55/hIofvHH+7x8=' 
WHERE 
  key_id = '40b366b2b84915fa53555e4854786d621b2830719365dc3676267aeb0a5f9a40' 
  AND (
    token = 'r6nsPJq4o1XPMxQ74IqMHxwXOz0zn55/hIofvHH+7x8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020