UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DFjDsxfmbML8HPM22fIajX/diWoJr+xb7+AWesai+uU=' 
WHERE 
  key_id = 'e4772367ab3ef6091dfa5e318e6de1a008d331df13a4eff1bd5203807980faa9' 
  AND (
    token = 'DFjDsxfmbML8HPM22fIajX/diWoJr+xb7+AWesai+uU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018