UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k488c8SZ7DpGwcd0SmMibWctgNBAOLCPcVa+PYaHDhE=' 
WHERE 
  key_id = 'b2a147b603c8a74b2bcb530164b53cb6e511835acbe3ac9194ec15cdf707ea3a' 
  AND (
    token = 'k488c8SZ7DpGwcd0SmMibWctgNBAOLCPcVa+PYaHDhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034