UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xdoNR1/k42jzgDKp1GunZf1ZOGKLpmKHjkL/ufnIrZk=' 
WHERE 
  key_id = '2a31aae6d174868a6dd2db8da1d03d8d6372b12192a169a8bccbd19a108338b0' 
  AND (
    token = 'xdoNR1/k42jzgDKp1GunZf1ZOGKLpmKHjkL/ufnIrZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032