UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vm1uluU7oL4GyWQAwODGSrIer0McYs94+QoAudoPxgw=' 
WHERE 
  key_id = '9a97b5962061ca4b9374d5569b3d0bfd8cdf56ddc5c38f1cc379884ed8a150fd' 
  AND (
    token = 'vm1uluU7oL4GyWQAwODGSrIer0McYs94+QoAudoPxgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034