UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4B5zrWpiReO7slXL65jyUEZnMNa5M4diwJ1c/wfGqG0=' 
WHERE 
  key_id = '324e86106f14e249e7df325f58e0258aaba0e7807fe40685f9ea2bbe7cae457f' 
  AND (
    token = '4B5zrWpiReO7slXL65jyUEZnMNa5M4diwJ1c/wfGqG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045