UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V4s/vICLrODvYG8qYKjwLHQyFEz5NqWHEMCV3uODtFc=' 
WHERE 
  key_id = 'd510a385abb121e6a009e44a9c38e24c4b81931b5b2794ddb86be6a0b7603892' 
  AND (
    token = 'V4s/vICLrODvYG8qYKjwLHQyFEz5NqWHEMCV3uODtFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026