UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zr2T7k8xeMqBFrbJ3IH0sS0NPB4JQ6bsaHjBNht687A=' 
WHERE 
  key_id = 'a0791efd51504d811c3c769ed361138522bf562e09418f86d4208017a3d5de9c' 
  AND (
    token = 'Zr2T7k8xeMqBFrbJ3IH0sS0NPB4JQ6bsaHjBNht687A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00100