UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BVOqzinseEfWD8FOM6rkkbKU6nSIEtl8lIeNFjM3Y+w=' 
WHERE 
  key_id = 'a30c4882661c28e664f1d8d5a1eafd38239b877aa290517ac5ac32468b1a266b' 
  AND (
    token = 'BVOqzinseEfWD8FOM6rkkbKU6nSIEtl8lIeNFjM3Y+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028