UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0a9mKz3bQfTj2qbYkl0180sO81HIBUdjBGATzua4yvc=' 
WHERE 
  key_id = 'c6365f169775a3c525d8181f50d011b82395121f2129a2e3da2a173ba59c5f1f' 
  AND (
    token = '0a9mKz3bQfTj2qbYkl0180sO81HIBUdjBGATzua4yvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042