UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kr5umd/1ctfyYZgNCJghxQnpNCf6fPkRfYuQrjTjRvI=' 
WHERE 
  key_id = '34343192b8202e0703411b9eabadee3b414723da93da68bdca9718006adab3ce' 
  AND (
    token = 'Kr5umd/1ctfyYZgNCJghxQnpNCf6fPkRfYuQrjTjRvI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039