UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r4addT9w99DlCW6Ou4whQ36zPZuzKYmbFNg9Swy4iZg=' 
WHERE 
  key_id = '49f98e8e24747ca31c2cfb0b0e35029cbb0630fbf6c9c73c7ab7c160c7efb66a' 
  AND (
    token = 'r4addT9w99DlCW6Ou4whQ36zPZuzKYmbFNg9Swy4iZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040