UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7jbdycNAUDcFvlqkrrC0J/dVd+i7ICabCsy/j5K6iic=' 
WHERE 
  key_id = '0789e832225942897532b5d23e5b6a19f8aaba3e12bb0b78a39287a8bd6e2ee1' 
  AND (
    token = '7jbdycNAUDcFvlqkrrC0J/dVd+i7ICabCsy/j5K6iic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042