UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EWXDrZVJLQYe1OqvpDKtNk8ByMWB3EhGz91B1ay/yFk=' 
WHERE 
  key_id = 'cfa05c028cac457a708629e47796d9146033796b9761a9e171784ebab318e7ac' 
  AND (
    token = 'EWXDrZVJLQYe1OqvpDKtNk8ByMWB3EhGz91B1ay/yFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037