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

Query time 0.00020