UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NTx+5UGVUApx4GZA7W8hSmbnui2L9ST4pxGQjIQYyoY=' 
WHERE 
  key_id = '718f137aa28247136fabf1cdf7c797fe423dd7a9ff95b6543a38a486894dd711' 
  AND (
    token = 'NTx+5UGVUApx4GZA7W8hSmbnui2L9ST4pxGQjIQYyoY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038