UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's36QpUN85GX5DbGEQcu6vysAyZtlNBTHsP2T9OQO+n8=' 
WHERE 
  key_id = '9effa7232707ee084409060269aad6866eed3b9be492a08d518586ba3c818179' 
  AND (
    token = 's36QpUN85GX5DbGEQcu6vysAyZtlNBTHsP2T9OQO+n8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077