UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'beZa7cROATgWRlSzYsB2PPZeDIrUpfjH7uRRtKYhU5s=' 
WHERE 
  key_id = '15e144819ddd6c5f7c6f108180f16173ac17560f0704a63c94a233ee78f6cd56' 
  AND (
    token = 'beZa7cROATgWRlSzYsB2PPZeDIrUpfjH7uRRtKYhU5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038